﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework_2
{
    class ShapeFactory
    {
        public string drawShapes(int mount)
        {
            string finalInfo="";
            Random random = new Random();
            double finalArea = 0;
            for (int i = 0; i < mount; i++)
            {
                Shape shape = null;
                switch (random.Next(0,3))
                {
                    case 0:
                        shape = new Circel((random.NextDouble()+0.1)*10);
                        break;
                    case 1:
                        shape = new Square((random.NextDouble() + 0.1) * 10);
                        break;
                    case 2:
                        shape = new Oblong((random.NextDouble() + 0.1) * 10, (random.NextDouble() + 0.1) * 10);
                        break;
                    default:
                        break;
                }
                finalArea += shape.getArea();
                finalInfo += shape.showInfo();
            }
            finalInfo += "\n总面积为" + finalArea;
            return finalInfo;
        }
    }
}
